//table  表格布局
//构造方法说明:
//Table({
//Key key,
//this.children: const <TableRow>[],
//this.columnWidths,//列宽
//this.defaultColumnWidth: const FlexColumnWidth(1.0),
//this.textDirection,//文字方向
//this.border,//边框
//this.defaultVerticalAlignment: TableCellVerticalAlignment.top,//对齐方式
//this.textBaseline//基线
//})

import 'package:flutter/material.dart';

class MyTableDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build

    return Scaffold(
      appBar: AppBar(
        title: Text('table 的使用'),
      ),
      body: Table(

        //边框  分割线
        border: TableBorder.all(color: Colors.red),
        //数据
        children: <TableRow>[
          TableRow(
            children: <Widget>[
              Text(
                '姓名',
                textAlign: TextAlign.center,
              ),
              Text(
                '职位',
                textAlign: TextAlign.center,
              ),
            ],
          ),
          TableRow(
            children: <Widget>[
              Text(
                '小明',
                textAlign: TextAlign.center,
              ),
              Text(
                '开发',
                textAlign: TextAlign.center,
              ),
            ],
          ),
          _reAha('小红', '艺术'),
          _reAha('小路', '秧歌'),
        ],
      ),
    );
  }

  TableRow _reAha(String name, String work) {
    return TableRow(children: <Widget>[
      Text(
        name,
        textAlign: TextAlign.center,
      ),
      Text(
        work,
        textAlign: TextAlign.center,
      )
    ]);
  }
}
